<!DOCTYPE html>
<title>Checks that attributes created setAttributeNS() don't cause two identical xmlns attributes to be serialized</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
setup({single_test: true});

window.doc = (new DOMParser()).parseFromString('<test/>', 'text/xml');
doc.documentElement.setAttributeNS('http://www.example.com', 'ns:attr', 'value');
doc.documentElement.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:ns', 'http://www.example.com');

// Check the DOM construction.
assert_equals(doc.documentElement.getAttributeNS("http://www.example.com", "attr"), "value");

window.xmlText = (new XMLSerializer()).serializeToString(doc); // exported for debugging
window.parsedDoc = (new DOMParser()).parseFromString(xmlText, 'text/xml');

// Check the serialization result.
assert_equals(parsedDoc.documentElement.getAttributeNS("http://www.example.com", "attr"), "value");
done();
</script>
